Don't use ext-readline handler on Mac to fix CR/LF issues on Mac only#73
Don't use ext-readline handler on Mac to fix CR/LF issues on Mac only#73clue merged 1 commit intoclue:masterfrom
Conversation
|
This is causing some weird issues. When I exit (by hitting Ctrl-D), it outputs I will try to poke at this a bit later and open a PR (it makes more sense for the guy with a Mac to poke at), but wanted to bring to your attention in case you already know what the issue or fix is. |
|
@mkopinsky Thank you for giving this a try and reporting back! I agree and any input would be very much appreciated, as I don't have a Mac to test against 👍 I can not reproduce any issues on my Ubuntu system, maybe we can also come up with a way to test this specific behavior? |
|
I can try to write a unit test as part of the PR. Seems that travis has a Mac OS environment so we can have that test run on Mac-only. |
|
Improving the test suite in this regard would be much appreciated! That being said, our latest tries with Travis' Mac builds weren't all that good (reactphp/stream#120 and others). |
|
I haven't quite been able to figure it out, but I wanted to share what I'm seeing.
If I comment out the fclose on |
|
Thank you for looking into this! I currently fail to see how the stream resource could be closed before invoking the The following is a gist of what the Stdio class does, so maybe this helps reproducing this: <?php
use React\Stream\ReadableResourceStream;
use React\EventLoop\Factory;
require __DIR__ . '/../vendor/autoload.php';
$loop = Factory::create();
$stdin = new ReadableResourceStream(STDIN, $loop);
$old = shell_exec('stty -g');
shell_exec('stty -icanon -echo');
$stdin->on('data', function ($chunk) use ($stdin) {
echo wordwrap(bin2hex($chunk), 2, ' ', true) . PHP_EOL;
if (strpos($chunk, "\x04") !== false) {
echo '[EOF]';
$stdin->close();
}
});
$stdin->on('close', function () use ($old) {
echo '[closed]';
shell_exec('stty ' . $old);
});
$loop->run(); |
|
With that mini script, it worked fine. |
|
That's strange. Can you try patching Line 228 in a62268d restoreTtyMode() at the start of the method?
|
|
@mkopinsky I think I've been able to track this down and managed to reproduce this on any system without |
Resolves / closes #66
Effectively reverts #63 on Mac